from fastapi import FastAPI
import uvicorn
from contextlib import asynccontextmanager

@asynccontextmanager
async def lifespan(app: FastAPI):
    print('start_event')
    yield
    print('end_event')

app = FastAPI(lifespan=lifespan)

# app = FastAPI

items = {}
#
#
# @app.on_event("startup")
# async def startup_event():
#     print('startup')
#
#
# @app.get("/items/{item_id}")
# async def read_items(item_id: str):
#     return items[item_id]
#
#
# @app.on_event("shutdown")
# def shutdown_event():
#     print('shutdown')


if __name__ == '__main__':
    uvicorn.run(app, host="0.0.0.0", port=8000, workers=2)